var assert = require('assert');
var should = require('should');
var util = require('util');
var _ = require('lodash');
var battleModel = require('../../app/models/battleModel');
var config = require('../config');

suite('测试BattleModel', function () {
    var battle_model;
    setup(function (done) {
        battleModel.getByRoleId(config.role_id, function (err, model) {
            assert.equal(err == null, true);
            battle_model = model;
            battle_model.addCup(100);
            battle_model.subCup(100);
            done();
        });
    });

    suite('getDoubleBattleExpNum', function () {
        test('获取双倍掠夺经验道具卡使用次数', function () {
            battle_model.getDoubleBattleExpNum();
        });
    });

    suite('addDoubleBattleExpNum', function () {
        test('增加双倍掠夺经验道具卡使用次数', function (done) {
            battle_model.addDoubleBattleExpNum(5);
            battle_model.save(done);
        });
    });

    suite('subDoubleBattleExpNum', function () {
        test('扣双倍除掠夺经验道具卡使用次数', function (done) {
            battle_model.subDoubleBattleExpNum(5);
            battle_model.save(done);
        });
    });
});

suite('测试BattleModel', function () {
    test('getCupRankByRoleId', function (done) {
        battleModel.getCupRankByRoleId(config.role_id, 30, function (err, res) {
            done();
        });
    });

    test('getCupTopFifty', function (done) {
        battleModel.getCupTopFifty(function (err, res) {
            done();
        });
    });
});
